\(\int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx\) [122]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [C] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 18, antiderivative size = 89 \[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=-\frac {a}{d (c+d x)}-\frac {a \cos (e+f x)}{d (c+d x)}-\frac {a f \operatorname {CosIntegral}\left (\frac {c f}{d}+f x\right ) \sin \left (e-\frac {c f}{d}\right )}{d^2}-\frac {a f \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (\frac {c f}{d}+f x\right )}{d^2} \]

[Out]

-a/d/(d*x+c)-a*cos(f*x+e)/d/(d*x+c)-a*f*cos(-e+c*f/d)*Si(c*f/d+f*x)/d^2+a*f*Ci(c*f/d+f*x)*sin(-e+c*f/d)/d^2

Rubi [A] (verified)

Time = 0.20 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {3398, 3378, 3384, 3380, 3383} \[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=-\frac {a f \operatorname {CosIntegral}\left (x f+\frac {c f}{d}\right ) \sin \left (e-\frac {c f}{d}\right )}{d^2}-\frac {a f \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (x f+\frac {c f}{d}\right )}{d^2}-\frac {a \cos (e+f x)}{d (c+d x)}-\frac {a}{d (c+d x)} \]

[In]

Int[(a + a*Cos[e + f*x])/(c + d*x)^2,x]

[Out]

-(a/(d*(c + d*x))) - (a*Cos[e + f*x])/(d*(c + d*x)) - (a*f*CosIntegral[(c*f)/d + f*x]*Sin[e - (c*f)/d])/d^2 -
(a*f*Cos[e - (c*f)/d]*SinIntegral[(c*f)/d + f*x])/d^2

Rule 3378

Int[((c_.) + (d_.)*(x_))^(m_)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(c + d*x)^(m + 1)*(Sin[e + f*x]/(d*(m
 + 1))), x] - Dist[f/(d*(m + 1)), Int[(c + d*x)^(m + 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && LtQ[
m, -1]

Rule 3380

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[SinIntegral[e + f*x]/d, x] /; FreeQ[{c, d,
 e, f}, x] && EqQ[d*e - c*f, 0]

Rule 3383

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[CosIntegral[e - Pi/2 + f*x]/d, x] /; FreeQ
[{c, d, e, f}, x] && EqQ[d*(e - Pi/2) - c*f, 0]

Rule 3384

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Dist[Cos[(d*e - c*f)/d], Int[Sin[c*(f/d) + f*x]
/(c + d*x), x], x] + Dist[Sin[(d*e - c*f)/d], Int[Cos[c*(f/d) + f*x]/(c + d*x), x], x] /; FreeQ[{c, d, e, f},
x] && NeQ[d*e - c*f, 0]

Rule 3398

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Sin[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[n, 0] && (EqQ[n, 1] ||
IGtQ[m, 0] || NeQ[a^2 - b^2, 0])

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {a}{(c+d x)^2}+\frac {a \cos (e+f x)}{(c+d x)^2}\right ) \, dx \\ & = -\frac {a}{d (c+d x)}+a \int \frac {\cos (e+f x)}{(c+d x)^2} \, dx \\ & = -\frac {a}{d (c+d x)}-\frac {a \cos (e+f x)}{d (c+d x)}-\frac {(a f) \int \frac {\sin (e+f x)}{c+d x} \, dx}{d} \\ & = -\frac {a}{d (c+d x)}-\frac {a \cos (e+f x)}{d (c+d x)}-\frac {\left (a f \cos \left (e-\frac {c f}{d}\right )\right ) \int \frac {\sin \left (\frac {c f}{d}+f x\right )}{c+d x} \, dx}{d}-\frac {\left (a f \sin \left (e-\frac {c f}{d}\right )\right ) \int \frac {\cos \left (\frac {c f}{d}+f x\right )}{c+d x} \, dx}{d} \\ & = -\frac {a}{d (c+d x)}-\frac {a \cos (e+f x)}{d (c+d x)}-\frac {a f \operatorname {CosIntegral}\left (\frac {c f}{d}+f x\right ) \sin \left (e-\frac {c f}{d}\right )}{d^2}-\frac {a f \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (\frac {c f}{d}+f x\right )}{d^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.48 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.88 \[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=-\frac {a \left (d (1+\cos (e+f x))+f (c+d x) \operatorname {CosIntegral}\left (f \left (\frac {c}{d}+x\right )\right ) \sin \left (e-\frac {c f}{d}\right )+f (c+d x) \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (f \left (\frac {c}{d}+x\right )\right )\right )}{d^2 (c+d x)} \]

[In]

Integrate[(a + a*Cos[e + f*x])/(c + d*x)^2,x]

[Out]

-((a*(d*(1 + Cos[e + f*x]) + f*(c + d*x)*CosIntegral[f*(c/d + x)]*Sin[e - (c*f)/d] + f*(c + d*x)*Cos[e - (c*f)
/d]*SinIntegral[f*(c/d + x)]))/(d^2*(c + d*x)))

Maple [A] (verified)

Time = 1.07 (sec) , antiderivative size = 124, normalized size of antiderivative = 1.39

method result size
parts \(-\frac {a}{d \left (d x +c \right )}+a f \left (-\frac {\cos \left (f x +e \right )}{\left (c f -d e +d \left (f x +e \right )\right ) d}-\frac {\frac {\operatorname {Si}\left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\operatorname {Ci}\left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}}{d}\right )\) \(124\)
derivativedivides \(\frac {a \,f^{2} \left (-\frac {\cos \left (f x +e \right )}{\left (c f -d e +d \left (f x +e \right )\right ) d}-\frac {\frac {\operatorname {Si}\left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\operatorname {Ci}\left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}}{d}\right )-\frac {a \,f^{2}}{\left (c f -d e +d \left (f x +e \right )\right ) d}}{f}\) \(143\)
default \(\frac {a \,f^{2} \left (-\frac {\cos \left (f x +e \right )}{\left (c f -d e +d \left (f x +e \right )\right ) d}-\frac {\frac {\operatorname {Si}\left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\operatorname {Ci}\left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}}{d}\right )-\frac {a \,f^{2}}{\left (c f -d e +d \left (f x +e \right )\right ) d}}{f}\) \(143\)
risch \(-\frac {a}{d \left (d x +c \right )}+\frac {i a f \,{\mathrm e}^{\frac {i \left (c f -d e \right )}{d}} \operatorname {Ei}_{1}\left (i f x +i e +\frac {i \left (c f -d e \right )}{d}\right )}{2 d^{2}}-\frac {i f a \,{\mathrm e}^{-\frac {i \left (c f -d e \right )}{d}} \operatorname {Ei}_{1}\left (-i f x -i e -\frac {i c f -i d e}{d}\right )}{2 d^{2}}-\frac {a \left (-2 d f x -2 c f \right ) \cos \left (f x +e \right )}{2 d \left (d x +c \right ) \left (-d f x -c f \right )}\) \(156\)

[In]

int((a+cos(f*x+e)*a)/(d*x+c)^2,x,method=_RETURNVERBOSE)

[Out]

-a/d/(d*x+c)+a*f*(-cos(f*x+e)/(c*f-d*e+d*(f*x+e))/d-(Si(f*x+e+(c*f-d*e)/d)*cos((c*f-d*e)/d)/d-Ci(f*x+e+(c*f-d*
e)/d)*sin((c*f-d*e)/d)/d)/d)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.18 \[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=-\frac {a d \cos \left (f x + e\right ) - {\left (a d f x + a c f\right )} \operatorname {Ci}\left (\frac {d f x + c f}{d}\right ) \sin \left (-\frac {d e - c f}{d}\right ) + {\left (a d f x + a c f\right )} \cos \left (-\frac {d e - c f}{d}\right ) \operatorname {Si}\left (\frac {d f x + c f}{d}\right ) + a d}{d^{3} x + c d^{2}} \]

[In]

integrate((a+a*cos(f*x+e))/(d*x+c)^2,x, algorithm="fricas")

[Out]

-(a*d*cos(f*x + e) - (a*d*f*x + a*c*f)*cos_integral((d*f*x + c*f)/d)*sin(-(d*e - c*f)/d) + (a*d*f*x + a*c*f)*c
os(-(d*e - c*f)/d)*sin_integral((d*f*x + c*f)/d) + a*d)/(d^3*x + c*d^2)

Sympy [F]

\[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=a \left (\int \frac {\cos {\left (e + f x \right )}}{c^{2} + 2 c d x + d^{2} x^{2}}\, dx + \int \frac {1}{c^{2} + 2 c d x + d^{2} x^{2}}\, dx\right ) \]

[In]

integrate((a+a*cos(f*x+e))/(d*x+c)**2,x)

[Out]

a*(Integral(cos(e + f*x)/(c**2 + 2*c*d*x + d**2*x**2), x) + Integral(1/(c**2 + 2*c*d*x + d**2*x**2), x))

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.32 (sec) , antiderivative size = 196, normalized size of antiderivative = 2.20 \[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=-\frac {\frac {2 \, a f^{2}}{{\left (f x + e\right )} d^{2} - d^{2} e + c d f} + \frac {{\left (f^{2} {\left (E_{2}\left (\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right ) + E_{2}\left (-\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right )\right )} \cos \left (-\frac {d e - c f}{d}\right ) - f^{2} {\left (-i \, E_{2}\left (\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right ) + i \, E_{2}\left (-\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right )\right )} \sin \left (-\frac {d e - c f}{d}\right )\right )} a}{{\left (f x + e\right )} d^{2} - d^{2} e + c d f}}{2 \, f} \]

[In]

integrate((a+a*cos(f*x+e))/(d*x+c)^2,x, algorithm="maxima")

[Out]

-1/2*(2*a*f^2/((f*x + e)*d^2 - d^2*e + c*d*f) + (f^2*(exp_integral_e(2, (I*(f*x + e)*d - I*d*e + I*c*f)/d) + e
xp_integral_e(2, -(I*(f*x + e)*d - I*d*e + I*c*f)/d))*cos(-(d*e - c*f)/d) - f^2*(-I*exp_integral_e(2, (I*(f*x
+ e)*d - I*d*e + I*c*f)/d) + I*exp_integral_e(2, -(I*(f*x + e)*d - I*d*e + I*c*f)/d))*sin(-(d*e - c*f)/d))*a/(
(f*x + e)*d^2 - d^2*e + c*d*f))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 535 vs. \(2 (90) = 180\).

Time = 0.31 (sec) , antiderivative size = 535, normalized size of antiderivative = 6.01 \[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=\frac {{\left ({\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} f^{2} \operatorname {Ci}\left (\frac {{\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} - d e + c f}{d}\right ) \sin \left (-\frac {d e - c f}{d}\right ) - d e f^{2} \operatorname {Ci}\left (\frac {{\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} - d e + c f}{d}\right ) \sin \left (-\frac {d e - c f}{d}\right ) + c f^{3} \operatorname {Ci}\left (\frac {{\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} - d e + c f}{d}\right ) \sin \left (-\frac {d e - c f}{d}\right ) - {\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} f^{2} \cos \left (-\frac {d e - c f}{d}\right ) \operatorname {Si}\left (\frac {{\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} - d e + c f}{d}\right ) + d e f^{2} \cos \left (-\frac {d e - c f}{d}\right ) \operatorname {Si}\left (\frac {{\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} - d e + c f}{d}\right ) - c f^{3} \cos \left (-\frac {d e - c f}{d}\right ) \operatorname {Si}\left (\frac {{\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} - d e + c f}{d}\right ) - d f^{2} \cos \left (-\frac {{\left (d x + c\right )} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )}}{d}\right )\right )} a d^{2}}{{\left ({\left (d x + c\right )} d^{4} {\left (\frac {d e}{d x + c} - \frac {c f}{d x + c} + f\right )} - d^{5} e + c d^{4} f\right )} f} - \frac {a}{{\left (d x + c\right )} d} \]

[In]

integrate((a+a*cos(f*x+e))/(d*x+c)^2,x, algorithm="giac")

[Out]

((d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) + f)*f^2*cos_integral(((d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) + f)
 - d*e + c*f)/d)*sin(-(d*e - c*f)/d) - d*e*f^2*cos_integral(((d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) + f) - d
*e + c*f)/d)*sin(-(d*e - c*f)/d) + c*f^3*cos_integral(((d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) + f) - d*e + c
*f)/d)*sin(-(d*e - c*f)/d) - (d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) + f)*f^2*cos(-(d*e - c*f)/d)*sin_integra
l(((d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) + f) - d*e + c*f)/d) + d*e*f^2*cos(-(d*e - c*f)/d)*sin_integral(((
d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) + f) - d*e + c*f)/d) - c*f^3*cos(-(d*e - c*f)/d)*sin_integral(((d*x +
c)*(d*e/(d*x + c) - c*f/(d*x + c) + f) - d*e + c*f)/d) - d*f^2*cos(-(d*x + c)*(d*e/(d*x + c) - c*f/(d*x + c) +
 f)/d))*a*d^2/(((d*x + c)*d^4*(d*e/(d*x + c) - c*f/(d*x + c) + f) - d^5*e + c*d^4*f)*f) - a/((d*x + c)*d)

Mupad [F(-1)]

Timed out. \[ \int \frac {a+a \cos (e+f x)}{(c+d x)^2} \, dx=\int \frac {a+a\,\cos \left (e+f\,x\right )}{{\left (c+d\,x\right )}^2} \,d x \]

[In]

int((a + a*cos(e + f*x))/(c + d*x)^2,x)

[Out]

int((a + a*cos(e + f*x))/(c + d*x)^2, x)